﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
#if NETFX_CORE
using Windows.UI.Xaml;
#endif

namespace ArchiSimple.Windows
{
    public class EnumToVisibility : EnumToBooleanConverter
    {
        public override object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return this.Convert(value, targetType, parameter, culture.Name);
        }

        public override object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return this.ConvertBack(value, targetType, parameter, culture.Name);
        }

        public override object Convert(object value, Type targetType, object parameter, string language)
        {
            var b = (bool)base.Convert(value, targetType, parameter, language);

            return b ? Visibility.Visible : Visibility.Collapsed;
        }

        public override object ConvertBack(object value, Type targetType, object parameter, string language)
        {
            var visi = (Visibility)value;

            return base.ConvertBack(visi == Visibility.Visible, targetType, parameter, language);
        }
    }
}
